@extends('layouts.admin')

@section('title', '学生学籍管理-添加')

@section('content')
    <article class="page-container">
        <form action="" method="post" class="form form-horizontal" id="form-techValue-add">
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>姓名：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="name" name="name">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>曾用名：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="old_name" name="old_name">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>学籍号：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="census_no" name="census_no">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>名族：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="nation" name="nation">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>出生日期：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <div class="row" style="margin-top:0;">
                        <div class="col-xs-4 col-sm-3">
                            <input type="text" onfocus="WdatePicker()" value="" id="born_date" name="born_date" class="input-text Wdate">
                        </div>
                        <div class="col-xs-4 col-sm-3">
                            <span class="select-box">
                                <select class="select" size="1"  id="sex" name="sex">
                                    <option value="F">女</option>
                                    <option value="M">男</option>
                                </select>
                            </span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>身份证号：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="id_card" name="id_card">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>户籍地：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="hometown" name="hometown">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>国籍：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="citizenship" name="citizenship">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>家住地址：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="home_address" name="home_address">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>现住地址：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="" placeholder="" id="now_address" name="now_address">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>其他：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <div class="skin-minimal">
                        <div class="check-box">
                            <input type="checkbox" id="is_macao_or_taiwan" name="is_macao_or_taiwan" value="1">
                            <label for="is_macao_or_taiwan">是否港澳台外</label>
                        </div>
                        <div class="check-box">
                            <input type="checkbox" id="is_only_child" name="is_only_child" value="1">
                            <label for="is_only_child">是否独生子女</label>
                        </div>
                        <div class="check-box">
                            <input type="checkbox" id="is_lodge" name="is_lodge" value="1">
                            <label for="is_lodge">是否寄宿</label>
                        </div>
                        <div class="check-box">
                            <input type="checkbox" id="is_learn_preschool" name="is_learn_preschool" value="1">
                            <label for="is_learn_preschool">是否受过学前教育</label>
                        </div>
                        <div class="check-box">
                            <input type="checkbox" id="is_leftover_child" name="is_leftover_child" value="1">
                            <label for="is_leftover_child">是否留守儿童</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                </div>
            </div>
        </form>
    </article>
@endsection
@section('script')
    <script>
        $(".input-text,.textarea").Huifocusblur();
        $("#form-techValue-add").validate({
            rules:{
                name:{
                    required:true
                },
                census_no:{
                    required:true,
                },
                born_date:{
                    required:true,
                },
                nation:{
                    required:true,
                },
                id_card:{
                    required:true,
                },
                hometown:{
                    required:true,
                },
                citizenship:{
                    required:true,
                },
                home_address:{
                    required:true,
                },
                now_address:{
                    required:true,
                },
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit({
                    type: 'post',
                    url: "{{url('student/student/add')}}",
                    success: function(data){
                        if(data['successFlag']==1){
                            layer_success_message("添加成功!");
                            setTimeout(function(){
                                parent.$(".btnSearch").click();
                                layer_close();
                            },500);
                        }else{
                            layer_error_message(data['msg']);
                        }
                    },
                    error: function(XmlHttpRequest, textStatus, errorThrown){
                        layer_error_message('添加失败!');
                    }
                });
            }
        });
    </script>
@endsection